package cn.com.czpb.client.app;

import android.app.Activity;
import android.content.Intent;

import cn.com.czpb.client.model.news.NewsBean;
import cn.com.czpb.client.module.news.activity.NewsAlbum_Activity;
import cn.com.czpb.client.module.news.activity.NewsDetailActivity;
import cn.com.czpb.client.module.news.activity.NewsHtmlActivity;
import cn.com.czpb.client.module.news.activity.NewsVideoActivity;
import cn.com.czpb.client.utils.AAnim;
import cn.com.czpb.client.utils.LogUtils;

/**
 * Created by 猪猪侠 on 2017/7/4.
 */

public class MyActivitymanager {
    //test
    public static void pushActivity(Activity context, NewsBean newsBean, String tid, String from,String rvalue) {
        Intent mIntent = new Intent();
        mIntent.putExtra("newbean", newsBean);
        mIntent.putExtra("nid", newsBean.getNid());
        mIntent.putExtra("tid", tid);
        mIntent.putExtra("from", from);
        LogUtils.e("rtype-->" + newsBean.getRtype());
        // 1新闻 2图集 3直播 4专题 5关联新闻 6视频
        if ("1".equals(newsBean.getRtype())) {
            mIntent.putExtra("voteflag", newsBean.getVoteflag());
            mIntent.setClass(context, NewsDetailActivity.class);
        } else if ("2".equals(newsBean.getRtype())) {
            mIntent.putExtra("rvalue", rvalue);
            mIntent.setClass(context, NewsAlbum_Activity.class);
        }else if ("7".equals(newsBean.getRtype())||"3".equals(newsBean.getRtype())||"11".equals(newsBean.getRtype())){
            mIntent.putExtra("url",newsBean.getNewsurl());
            LogUtils.e("url:"+newsBean.getNewsurl());
            mIntent.setClass(context, NewsHtmlActivity.class);
        }
        else if ("4".equals(newsBean.getRtype())) {
            mIntent.putExtra("voteflag", newsBean.getVoteflag());
            mIntent.setClass(context, NewsDetailActivity.class);
        }else if("6".equals(newsBean.getRtype())){

            mIntent.putExtra("rvalue", rvalue);
            mIntent.putExtra("nid", newsBean.getNid());
            mIntent.setClass(context, NewsVideoActivity.class);
        }
        else {
            mIntent.setClass(context, NewsDetailActivity.class);
        }
        context.startActivityForResult(mIntent, 0);
        AAnim.ActivityStartAnimation(context);
    }
}
